import request from "@/utils/request.js"

//查询最新课程
export const reqNewCourse = (data) => {
    return request({
        url:"/api/course/mostNew",
        method:"post",
        data
    })
}

//查询课程详情
export const reqCourseDetail = (params) => {
    return request({
        url:"/api/course/getDetail",
        method:"get",
        params
    })
}

//课程资料下载
export function reqDownloadData(params){
    return request({
        url:"/api/course/downloadAttachment",
        method:"get",
        params
    })
}

//判断是否有权限下载课程资料 params:{courseId,chapterId}
export function reqIsHasCourseJurisdiction(params){
    return request({
        url:"/api//course/checkAuth",
        method:"get",
        params
    })
}

//课程播放地址api(当前接口没用)
export const reqPlayer = (params) => {
    return request({
        url:"/api/player/play",
        method:"get",
        params
    })
}

//记录课程播放历史api
/**
 * 参数：{
 *      chapterId: "",//章节ID
 *      courseId: "",//课程ID
 *      memberId: "",//会员ID
 *      lastTime: ""//上次观看时间
 *    }
 */
export const reqRecordHistory = (data) => {
    return request({
        url:"/api/course/history/recordHistory",
        method:"post",
        data
    })
}

//获取当前课程章节视频的最后观看时间
/**
 * 参数 memberId	会员id
 *      courseId	课程id
 *      chapterId   章节id
 */
export const reqLastWatchTime = (params) => {
    return request({
        url:"/api/course/history/getLastHistoryByChapterId",
        method:"get",
        params
    })
}
